namespace Crux.Core.Websockets;
/// <summary>
/// ILifetimeManager
/// </summary>
public interface ILifetimeManager
{

    /// <summary>
    ///
    /// </summary>
    /// <param name="webSocketConnectionContext"></param>
    /// <returns></returns>
    Task OnConnectedAsync(WebSocketConnectionContext webSocketConnectionContext);
    /// <summary>
    ///
    /// </summary>
    /// <param name="webSocketConnectionContext"></param>
    /// <returns></returns>
    Task OnDisconnectedAsync(WebSocketConnectionContext webSocketConnectionContext);
    /// <summary>
    ///
    /// </summary>
    /// <param name="methodName"></param>
    /// <param name="args"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    Task SendAllAsync(
        string methodName,
        object[] args,
        CancellationToken cancellationToken = default);
    /// <summary>
    ///
    /// </summary>
    /// <param name="methodName"></param>
    /// <param name="args"></param>
    /// <param name="exceptList"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    Task SendAllExceptAsync(
        string methodName,
        object[] args,
        IReadOnlyList<string> exceptList,
        CancellationToken cancellationToken = default);
    /// <summary>
    ///
    /// </summary>
    /// <param name="connectionId"></param>
    /// <param name="methodName"></param>
    /// <param name="args"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    Task SendConnectionAsync(
        string connectionId,
        string methodName,
        object[] args,
        CancellationToken cancellationToken = default);
    /// <summary>
    ///
    /// </summary>
    /// <param name="connectionIds"></param>
    /// <param name="methodName"></param>
    /// <param name="args"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    Task SendConnectionsAsync(
        IReadOnlyList<string> connectionIds,
        string methodName,
        object[] args,
        CancellationToken cancellationToken = default);
    /// <summary>
    ///
    /// </summary>
    /// <param name="groupName"></param>
    /// <param name="methodName"></param>
    /// <param name="args"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    Task SendGroupAsync(
        string groupName,
        string methodName,
        object[] args,
        CancellationToken cancellationToken = default);
    /// <summary>
    ///
    /// </summary>
    /// <param name="groupNames"></param>
    /// <param name="methodName"></param>
    /// <param name="args"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    Task SendGroupsAsync(
        IReadOnlyList<string> groupNames,
        string methodName,
        object[] args,
        CancellationToken cancellationToken = default);
    /// <summary>
    ///
    /// </summary>
    /// <param name="groupName"></param>
    /// <param name="methodName"></param>
    /// <param name="args"></param>
    /// <param name="connectionIds"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    Task SendGroupExceptAsync(
        string groupName,
        string methodName,
        object[] args,
        IReadOnlyList<string> connectionIds,
        CancellationToken cancellationToken = default);
    /// <summary>
    ///
    /// </summary>
    /// <param name="connectionId"></param>
    /// <param name="groupName"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    Task AddToGroupAsync(
        string connectionId,
        string groupName,
        CancellationToken cancellationToken = default);
    /// <summary>
    ///
    /// </summary>
    /// <param name="connectionId"></param>
    /// <param name="groupName"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    Task RemoveToGroupAsync(
        string connectionId,
        string groupName,
        CancellationToken cancellationToken = default);
    /// <summary>
    ///
    /// </summary>
    /// <param name="userId"></param>
    /// <param name="methodName"></param>
    /// <param name="args"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    Task SendUserAsync(
        string userId,
        string methodName,
        object[] args,
        CancellationToken cancellationToken = default);
    /// <summary>
    ///
    /// </summary>
    /// <param name="userId"></param>
    /// <param name="methodName"></param>
    /// <param name="args"></param>
    /// <param name="cancellation"></param>
    /// <returns></returns>
    Task SendUsersAsync(
        IReadOnlyList<string> userId,
        string methodName,
        object[] args,
        CancellationToken cancellation = default);
}